cmake_minimum_required(VERSION 3.5)
set(CMAKE_VERBOSE_MAKEFILE OFF)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

SET(CMAKE_BUILD_TYPE "Debug")
SET(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g2 -ggdb")
SET(COMMON_SRC xudp.pb.cc common.cpp)
find_library(PB libprotobuf.a)
add_subdirectory(handy)

include_directories(".")
add_executable(client_tcp client_tcp.cpp ${COMMON_SRC})
target_link_libraries(client_tcp handy pthread ${PB})

add_executable(server_tcp server_tcp.cpp ${COMMON_SRC})
target_link_libraries(server_tcp handy pthread ${PB})

add_executable(server_udp server_udp.cpp ${COMMON_SRC})
target_link_libraries(server_udp handy pthread ${PB})

add_executable(client_udp client_udp.cpp ${COMMON_SRC})
target_link_libraries(client_udp handy pthread ${PB})

add_executable(client_kcp client_kcp.cpp ikcp.c ${COMMON_SRC})
target_link_libraries(client_kcp handy pthread ${PB})

add_executable(server_kcp server_kcp.cpp ikcp.c ${COMMON_SRC})
target_link_libraries(server_kcp handy pthread ${PB})

add_executable(client_full_udp client_full_udp.cpp ${COMMON_SRC})
target_link_libraries(client_full_udp handy pthread ${PB})

add_executable(server_full_udp server_full_udp.cpp ${COMMON_SRC})
target_link_libraries(server_full_udp handy pthread ${PB})

add_executable(client_partial_udp client_partial_udp.cpp ${COMMON_SRC})
target_link_libraries(client_partial_udp handy pthread ${PB})

add_executable(server_partial_udp server_partial_udp.cpp ${COMMON_SRC})
target_link_libraries(server_partial_udp handy pthread ${PB})
